{include file="Public:header" /}
<link href="__PUBLIC__/Admin/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />

<style>
    .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{
        padding:0px 5px;
        text-align: center; 
        vertical-align: middle!important;
    }
</style>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>预约列表</h5>
                        <div class="ibox-tools" style="margin-top: -6px;">
                            <a href="__MODULE__/{$Think.CONTROLLER_NAME}/{$Think.ACTION_NAME}" class="btn btn-primary"><i class="fa fa-refresh"></i> 刷新</a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                            <div class="col-sm-2">
                                <!--<a href="__URL__/addMake?act=add" class="btn btn-primary"><span class="fa fa-plus"></span>添加预约</a>-->
                            </div>
                            <form class="form-inline" action="__URL__/makeList" method="get">
                                <div class="col-sm-10">
                                    <div class="input-group col-sm-3  pull-right">
                                        <input type="text" name="name" placeholder="专家姓名" value="{$sourch['name']}" class="input-sm form-control"> 
                                        <span class="input-group-btn">
                                            <button type="submit" class="btn btn-sm btn-primary"> 搜索</button>
                                        </span>
                                    </div>
                                    <div class="input-group col-sm-2 pull-right">
                                        <input type="text" name="mobile" placeholder="手机号码" value="{$sourch['mobile']}" class="input-sm form-control select_no_border"> 
                                    </div>
                                    <div class="input-group col-sm-2 pull-right select_width">
                                        <select name="type" class="input-sm form-control select_no_border">
                                            <option value="">专家类型</option>
                                            {foreach name="category" item="category"}
                                            <option {if condition="$category['id'] eq $sourch['type']"}selected{/if} value="{$category['id']}">{$category['name']}</option>
                                            {/foreach}
                                        </select>
                                    </div>

                                    <div class="input-group col-sm-3 pull-right">
                                        <span class="input-group-addon">
                                            <span class="fa fa-calendar"></span>
                                        </span>
                                        <input type="text" name="add_time" value="{$sourch['add_time']}" class="input-sm form-control select_no_border" id="start_time">

                                    </div>

                                </div>
                            </form>  
                        </div>

                        <br />

                        <div class="table-responsive">
                            <form action="__URL__/operate" method="post" id="operate_form">	
                                <table class="table table-bordered table-hover"
                                       id="categoryTable">
                                    <thead>
                                        <tr class="active">
                                            <th><input onclick="choosebox(this)" type="checkbox" /></th>
                                            <th height="40">编号</th>
                                            <th>证件头像</th>
                                            <th>专家姓名</th>
                                            <th>专家类型</th>
                                            <th>联系方式</th>
                                            <!--<th>访问量</th>-->
                                            <!--<th>好评率</th>-->
                                            <th>审核状态</th>
                                            <th>是否置顶</th>
                                            <th width="10%">发布时间</th>
                                            <th width="100">操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        {foreach name="make" item="make"}
                                        <tr>
                                            <td><input type="checkbox" name="make_id[]" value="{$make['id']}" /></td>
                                            <td>{$make['id']}</td>
                                            <td><img alt="image" style="width:50px;height:50px;" class="img-circle" src="{$make['head_img']}"></td>
                                            <td>{$make['name']}</td>
                                            <td>{$make['type_name']}</td>
                                            <td>{$make['mobile']}</td>
                                            <!--<td>{$make['visit_number']}</td>-->
                                            <!--<td>{$make['praise_number']}</td>-->
                                            <td> {switch name="make['trial_status']"}
                                                {case value="1"}待审核 {/case}
                                                {case value="2"}通过 {/case}
                                                {case value="3"}不通过{/case}
                                                {/switch}
                                            </td>
                                            <td>{if condition="$make['is_top'] eq 1"}是{else/}否{/if}</td>
                                            <td>
                                                {$make['add_time']|date="Y-m-d H:i:s",###}
                                            </td>
                                            <td class="center">
                                                <!-- <button class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top" title="标为垃圾邮件"><i class="fa fa-trash-o"></i>
                         </button> -->
                                                <div class="dropdown">
                                                    <button class="btn btn-primary dropdown-toggle"
                                                            type="button" id="dropdownMenu1" data-toggle="dropdown"
                                                            aria-haspopup="true" aria-expanded="true">
                                                        操作
                                                        <span class="caret"></span>
                                                    </button>
                                                    <ul class="dropdown-menu" style="min-width: 90px;" aria-labelledby="dropdownMenu1">
                                                        <li>
                                                            <a role="button" class="btn btn-primary"
                                                               style="margin-bottom: 0px;" 
                                                               href="__URL__/addMake?id={$make['id']}&act=edit">
                                                                <span class="fa fa-edit"></span>
                                                                修改
                                                            </a>
                                                        </li>
                                                        <li>
                                                            <a role="button" class="btn btn-danger"
                                                               style="margin-bottom: 0px;"
                                                               onclick="deleteMake(this, {$make['id']})" href="javascript:void(0);">
                                                                <span class="fa fa-trash-o"></span>
                                                                删除
                                                            </a>
                                                        </li>
                                                    </ul>
                                                </div> 
                                            </td>
                                        </tr>
                                        {/foreach}
                                    </tbody>
                                </table>
                                <div class="col-sm-12" style="padding:0px;">
                                    <div class="col-sm-4" style="padding-left:0px;"> 
                                        <select id="operate" name="operate" class="input-sm form-control pull-left" style="width:100px;margin-right: 5px;">
                                            <option value="0">选择操作</option>
                                            <option value="trial_status">审核通过</option>
                                            <option value="not_trial_status">审核不通过</option>
                                            <option value="is_top">置顶</option>
                                            <option value="del">删除</option>
                                        </select>
                                        <button tpye="button"  class="btn btn-primary pull-left"> 确认</button>
                                    </div>
                                    <div class="col-sm-8" style="padding:0px;">
                                        <ul class="pagination  pull-right">
                                            {$page}
                                        </ul>
                                    </div>
                                </div>	
                            </form>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>

        function choosebox(o) {
            var vt = $(o).is(':checked');
            if (vt) {
                $('input[type=checkbox]').prop('checked', vt);
            } else {
                $('input[type=checkbox]').removeAttr('checked');
            }
        }
    </script>

    {include file="Public:footer" /}
<script src="__PUBLIC__/Admin/daterangepicker/moment.min.js" type="text/javascript"></script>
    <script src="__PUBLIC__/Admin/daterangepicker/daterangepicker.js" type="text/javascript"></script>
    <script>
      
//修改菜单
        function editGroup(obj) {
            var group_id = $(obj).attr('group_id');
            var group_title = $(obj).attr('group_title');
            $('#myModal').modal('show');
            $("#defaultForm").attr('action', '__URL__/editUserGroup?id=' + group_id);
            $("input[name='title']").val(group_title);
        }

// window.onload=setTotal();	

//删除
        function deleteMake(obj, id) {
            layer.confirm('确定要删除数据吗', {btn: ['确认', '取消'], icon: 3, closeBtn: 2}, function(index) {
                $.ajax({
                    url: '__URL__/deleteMake',
                    data: {'id': id},
                    type: 'get',
                    dataType: 'json',
                    async: false, //取消同步，执行完之后再往下执行
                    success: function(data) {
                        if (data.status == 1) {
                            layer.msg('' + data.message + '', {icon: 1, time: 1000});
                            $(obj).parent('li').parent('ul').parent('div').parent('td').parent('tr').remove();
                        } else if (data.status == 2) {
                            layer.msg('' + data.message + '', {icon: 2, time: 2000});
                        }
                    }
                });
            });
        }
    </script>
    <script>
        $(document).ready(function() {
            $('#start_time').daterangepicker({
                format: "YYYY-MM-DD",
                singleDatePicker: false,
                showDropdowns: true,
                minDate: '2016-01-01',
                maxDate: '2030-01-01',
                startDate: '2016-01-01',
                endDate: '2017-01-01',
                showWeekNumbers: true,
                timePicker: false,
                timePickerIncrement: 1,
                timePicker12Hour: true,
                ranges: {
                    '今天': [moment(), moment()],
                    '昨天': [moment().subtract('days', 1), moment().subtract('days', 1)],
                    '最近7天': [moment().subtract('days', 6), moment()],
                    '最近30天': [moment().subtract('days', 29), moment()],
                    '上一个月': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
                },
                opens: 'right',
                buttonClasses: ['btn btn-default'],
                applyClass: 'btn-small btn-primary',
                cancelClass: 'btn-small',
                locale: {
                    applyLabel: '确定',
                    cancelLabel: '取消',
                    fromLabel: '起始时间',
                    toLabel: '结束时间',
                    customRangeLabel: '自定义',
                    daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
                    monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
                    firstDay: 1
                }
            });

        });
    </script>
    <script>
        //操作
        $('#operate_form').submit(function() {
            var op_type = $("select[name='operate']").val();
            if (op_type == 0) {
                layer.msg('请选择操作', {time: 1000});   //alert('请选择操作');
                return false;
            }
            var selected = $("input[name='make_id[]']:checked");
            if (selected.length < 1) {
                layer.msg('请选择记录', {time: 1000}); //            alert('请选择项目');
                return false;
            }

        });
    </script>
</body>
</html>
